﻿using System;

namespace Mono.Cecil.Metadata
{
	// Token: 0x02000112 RID: 274
	internal sealed class UserStringHeap : StringHeap
	{
		// Token: 0x06000A60 RID: 2656 RVA: 0x00005BDF File Offset: 0x00003DDF
		public UserStringHeap(byte[] data) : base(data)
		{
		}

		// Token: 0x06000A61 RID: 2657 RVA: 0x0002EA08 File Offset: 0x0002CC08
		protected override string ReadStringAt(uint index)
		{
			int num = (int)index;
			uint num2 = (uint)((ulong)this.data.ReadCompressedUInt32(ref num) & 18446744073709551614UL);
			bool flag = num2 < 1U;
			string result;
			if (flag)
			{
				result = string.Empty;
			}
			else
			{
				char[] array = new char[num2 / 2U];
				int num3 = num;
				int num4 = 0;
				while ((long)num3 < (long)num + (long)((ulong)num2))
				{
					array[num4++] = (char)((int)this.data[num3] | (int)this.data[num3 + 1] << 8);
					num3 += 2;
				}
				result = new string(array);
			}
			return result;
		}
	}
}
